package com.ja.openchat.viewmodels;

import android.app.Application;
import android.os.Bundle;

import androidx.annotation.NonNull;

import com.ja.openchat.ui.me.RechargeSuccessFragment;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.binding.command.BindingConsumer;
import me.goldze.mvvmhabit.utils.KLog;


public class RechargeViewModel extends BaseViewModel {

    //金额
    public String money;

    public RechargeViewModel(@NonNull Application application) {
        super(application);
    }

    //提交按钮的点击事件
    public BindingCommand confirmOnClickCommand = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            Bundle bundle = new Bundle();
            bundle.putString("money", money);
            startContainerActivity(RechargeSuccessFragment.class.getCanonicalName(),bundle);
        }
    });

    //金额改变的回调事件
    public BindingCommand onTextChangeCommand = new BindingCommand<>(new BindingConsumer<String>() {
        @Override
        public void call(String s) {
            KLog.d("onTextChangeCommand money==" + s);
            money = s;
        }
    });
    public BindingCommand onCheckedChangedCommand = new BindingCommand<>(new BindingConsumer<String>() {
        @Override
        public void call(String s) {
            KLog.d("onCheckedChangedCommand==" + s);

        }
    });
}
